home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: Alpha / Whiteline Alpha.iso / progtool / pascal / o_gem / units / odialogs.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-09-22  |  40.5 KB  |  1,582 lines

  1. {**************************************
  2.  *  O b j e c t G E M   Version 1.17  *
  3.  *  Copyright 1992-94 by Thomas Much  *
  4.  **************************************
  5.  *       Unit  O D I A L O G S        *
  6.  **************************************
  7.  *    Softdesign Computer Software    *
  8.  *    Thomas Much, Gerwigstraße 46,   *
  9.  *  76131 Karlsruhe, (0721) 62 28 41  *
  10.  *         Thomas Much @ KA2          *
  11.  *  UK48@ibm3090.rz.uni-karlsruhe.de  *
  12.  **************************************
  13.  *    erstellt am:        13.07.1992  *
  14.  *    letztes Update am:  09.09.1994  *
  15.  **************************************}
  16.  
  17. {
  18.   WICHTIGE ANMERKUNGEN ZUM QUELLTEXT:
  19.  
  20.   ObjectGEM wird mit dem _vollständigen_ Quelltext ausgeliefert, d.h.
  21.   jeder kann sich die Unit selbst compilieren, womit die extrem lästigen
  22.   Kompatibilitätsprobleme mit den PP-Releases beseitigt sind.
  23.   ObjectGEM ist und bleibt aber trotzdem SHAREWARE, d.h. wer die Biblio-
  24.   thek regelmäßig benutzt, muß sich REGISTRIEREN lassen. Dafür gibt es
  25.   die neueste Version und - gegen einen geringen Aufpreis - auch ein
  26.   gedrucktes Handbuch.
  27.  
  28.   WICHTIG: Wer den Quelltext verändert und dann Probleme beim Compilieren,
  29.   Ausführen o.ä. hat, kann nicht damit rechnen, daß ich den Fehler suche;
  30.   tritt der Fehler allerdings auch mit dem Original-Quelltext auf, würde
  31.   ich mich über eine genaue Fehlerbeschreibung freuen. Veränderte Quell-
  32.   texte dürfen _nicht_ weitergegeben werden, dies wäre ein Verstoß gegen
  33.   das Copyright!
  34.  
  35.   Wer beim Durchstöbern des Textes auf vermeintliche Fehler oder verbesse-
  36.   rungswürdige Stellen trifft (von letzterem gibt es sicherlich noch viele),
  37.   kann mir dies gerne mitteilen - ich habe auch ich nichts gegen kostenlos
  38.   zur Verfügung gestellte optimierte Routinen (sofern sich jemand die Mühe
  39.   macht). Wer in anderen Projekten, die nicht in direkter Konkurrenz zu
  40.   ObjectGEM stehen, einzelne Routinen verwenden möchte, wendet sich bitte
  41.   an mich (ein solcher Austausch sollte kein Problem sein).
  42.  
  43.   Wer sich auf nicht dokumentierte "implementation"- oder "private"-Eigen-
  44.   schaften verläßt, darf sich nicht über Inkompatibilitäten zu späteren
  45.   Versionen wundern; wer meint, eine Dokumentationslücke entdeckt zu haben,
  46.   kann mir dies gerne mitteilen.
  47.  
  48.   Kleine Info zum Schluß: Als "default tabsize" verwende ich 2. Wer drei
  49.   Punkte ("...") im Quelltext entdeckt, hat eine Stelle gefunden, an der
  50.   ich z.Z. arbeite ;-)
  51.  
  52.   "Möge die OOP mit Euch sein!"
  53. }
  54.  
  55.  
  56. {$IFDEF DEBUG}
  57.     {$B+,D+,G-,I-,L+,N-,P-,Q+,R+,S+,T-,V-,X+,Z+}
  58. {$ELSE}
  59.     {$B+,D-,G-,I-,L-,N-,P-,Q-,R-,S-,T-,V-,X+,Z+}
  60. {$ENDIF}
  61.  
  62. unit ODialogs;
  63.  
  64. interface
  65.  
  66. uses
  67.  
  68.     Strings,Tos,Gem,OTypes,OWindows;
  69.  
  70. type
  71.  
  72.     PScrollBar = ^TScrollBar;
  73.     TScrollBar = object(TControl)
  74.         public
  75.         LineMagnitude,
  76.         PageMagnitude,
  77.         Size         : longint;
  78.         IsHorizontal : boolean;
  79.         constructor Init(AParent: PDialog; SIndx,DIndx,IIndx: integer; TheSize,TheRange: longint; Hlp: string);
  80.         function TestIndex(AnIndx: integer): boolean; virtual;
  81.         function Transfer(DataPtr: pointer; TransferFlag: word): word; virtual;
  82.         procedure Changed(AnIndx: integer; DblClick: boolean); virtual;
  83.         procedure Work; virtual;
  84.         procedure SetPosition(ThumbPos: longint); virtual;
  85.         function GetPosition: longint; virtual;
  86.         function DeltaPos(Delta: longint): longint; virtual;
  87.         procedure SetRange(LoVal,HiVal: longint); virtual;
  88.         function GetRange(var LoVal,HiVal: longint): longint; virtual;
  89.         function GetSBoxMin: integer; virtual;
  90.         private
  91.         lowval,
  92.         highval,
  93.         SPos,
  94.         Range   : longint;
  95.         DecIndx,
  96.         IncIndx : integer;
  97.         initflag: boolean;
  98.         DecAddr,
  99.         IncAddr : PObj
  100.     end;
  101.  
  102.     PGroupBox = ^TGroupBox;
  103.     TGroupBox = object(TControl)
  104.         public
  105.         constructor Init(AParent: PDialog; AnIndx: integer; ATitle,Hlp: string);
  106.         destructor Done; virtual;
  107.         procedure SetText(ATextString: string); virtual;
  108.         function GetText: string; virtual;
  109.         private
  110.         Title    : PString;
  111.         oldflags : word;
  112.         oldobspec: longint
  113.     end;
  114.  
  115.     PCheckBox = ^TCheckBox;
  116.     TCheckBox = object(TButton)
  117.         public
  118.         constructor Init(AParent: PDialog; AnIndx: integer; UserDef: boolean; Hlp: string);
  119.         function Install: boolean; virtual;
  120.         procedure Deinstall; virtual;
  121.         function Transfer(DataPtr: pointer; TransferFlag: word): word; virtual;
  122.         procedure SetCheck(CheckFlag: integer); virtual;
  123.         function GetCheck: integer; virtual;
  124.         procedure Check; virtual;
  125.         procedure Uncheck; virtual;
  126.         procedure Toggle; virtual;
  127.     end;
  128.  
  129.     PTriState = ^TTriState;
  130.     TTriState = object(TCheckBox)
  131.         public
  132.         constructor Init(AParent: PDialog; AnIndx: integer; Hlp: string);
  133.         procedure Gray; virtual;
  134.     end;
  135.  
  136.     PRadioButton = ^TRadioButton;
  137.     TRadioButton = object(TCheckBox)
  138.         public
  139.         constructor Init(AParent: PDialog; AnIndx: integer; UserDef: boolean; Hlp: string);
  140.         procedure SetState(StateFlag: integer); virtual;
  141.         function Install: boolean; virtual;
  142.     end;
  143.  
  144.     PComboBox    = ^TComboBox;
  145.     TComboBox    = object(TControl)
  146.         public
  147.         Popup: PPopup;
  148.         Edit : PEdit;
  149.         constructor Init(AParent: PDialog; AnIndx,CycleIndx,TitleIndx,ptIndx,popIndx: integer; Cycle,Editable: boolean; Hlp: string);
  150.         destructor Done; virtual;
  151.         function TestIndex(AnIndx: integer): boolean; virtual;
  152.         function Transfer(DataPtr: pointer; TransferFlag: word): word; virtual;
  153.         procedure Changed(AnIndx: integer; DblClick: boolean); virtual;
  154.         procedure Work; virtual;
  155.         procedure SetText(ATextString: string); virtual;
  156.         function GetText: string; virtual;
  157.         procedure Paint; virtual;
  158.         function GetSelection: integer; virtual;
  159.         procedure SetSelection(Sel: integer); virtual;
  160.         function GetEdit: PEdit; virtual;
  161.         private
  162.         cindx,
  163.         tindx,
  164.         pindx,
  165.         tpindx,
  166.         select,
  167.         oldtype,
  168.         oldttype  : integer;
  169.         oldtobspec: longint;
  170.         caddr,
  171.         taddr     : PObj;
  172.         cycl,
  173.         initflag  : boolean;
  174.         usrtblk   : USERBLK
  175.     end;
  176.  
  177.     PNotepad = ^TNotepad;
  178.     TNotepad = object(TControl)
  179.         public
  180.         constructor Init(AParent: PDialog; AnIndx,PadIndx,AGroup: integer; Hlp: string);
  181.         private
  182.         group,
  183.         pad  : integer;
  184.         paddr: PObj
  185.     end;
  186.  
  187.     PListBox     = ^TListBox;
  188.     TListBox     = object(TControl)
  189.         { ... }
  190.     end;
  191.  
  192.  
  193.  
  194. implementation
  195.  
  196. uses
  197.  
  198.     OProcs;
  199.  
  200. const
  201.  
  202.     cbUnchecked = $1000;
  203.     cbChecked   = $2000;
  204.     cbGrayed    = $3000;
  205.     cbFlags     = cbUnchecked or cbChecked or cbGrayed;
  206.     cbType      = $4000;
  207.     cbAll       = not(cbFlags or cbType);
  208.     UDCOL       = Blue;
  209.     HOTCOL      = Red;
  210.  
  211.  
  212. function DrawCycleBox(dummy1,dummy2: pointer; parm: PARMBLKPtr): word; forward;
  213. function DrawGroupBox(dummy1,dummy2: pointer; parm: PARMBLKPtr): word; forward;
  214. function DrawCheckBox(dummy1,dummy2: pointer; parm: PARMBLKPtr): word; forward;
  215. function DrawRadioButton(dummy1,dummy2: pointer; parm: PARMBLKPtr): word; forward;
  216. function DrawComboTitle(dummy1,dummy2: pointer; parm: PARMBLKPtr): word; forward;
  217.  
  218.  
  219. { *** Objekt TSCROLLBAR *** }
  220.  
  221. constructor TScrollBar.Init(AParent: PDialog; SIndx,DIndx,IIndx: integer; TheSize,TheRange: longint; Hlp: string);
  222.  
  223.     begin
  224.         if not(inherited Init(AParent,SIndx,Hlp)) then fail;
  225.         Style:=cs_ScrollBar;
  226.         ID:=id_NoExit;
  227.         initflag:=true;
  228.         DecIndx:=DIndx;
  229.         IncIndx:=IIndx;
  230.         DecAddr:=@Parent^.DlgTree^[DecIndx];
  231.         IncAddr:=@Parent^.DlgTree^[IncIndx];
  232.         if (DecAddr=nil) or (IncAddr=nil) then
  233.             begin
  234.                 inherited Done;
  235.                 fail
  236.             end;
  237.         if ((DecAddr^.ob_type and $ff)<>G_BOXCHAR) or ((IncAddr^.ob_type and $ff)<>G_BOXCHAR) or
  238.            ((ObjAddr^.ob_type and $ff)<>G_BOX) or (ObjAddr^.ob_head=-1) then
  239.             begin
  240.                 inherited Done;
  241.                 fail
  242.             end;
  243.         if ObjAddr^.ob_height>ObjAddr^.ob_width then
  244.             begin
  245.                 DecAddr^.ob_spec.index:=(DecAddr^.ob_spec.index and $00ffffff) or ($01000000);
  246.                 IncAddr^.ob_spec.index:=(IncAddr^.ob_spec.index and $00ffffff) or ($02000000);
  247.                 Parent^.DlgTree^[ObjAddr^.ob_head].ob_width:=ObjAddr^.ob_width;
  248.                 Parent^.DlgTree^[ObjAddr^.ob_head].ob_x:=0;
  249.                 Style:=Style or sbs_Vert;
  250.                 IsHorizontal:=false
  251.             end
  252.         else
  253.             begin
  254.                 DecAddr^.ob_spec.index:=(DecAddr^.ob_spec.index and $00ffffff) or ($04000000);
  255.                 IncAddr^.ob_spec.index:=(IncAddr^.ob_spec.index and $00ffffff) or ($03000000);
  256.                 Parent^.DlgTree^[ObjAddr^.ob_head].ob_height:=ObjAddr^.ob_height;
  257.                 Parent^.DlgTree^[ObjAddr^.ob_head].ob_y:=0;
  258.                 Style:=Style or sbs_Horz;
  259.                 IsHorizontal:=true
  260.             end;
  261.         DecAddr^.ob_flags:=(DecAddr^.ob_flags and not(SELECTABLE or DEFAULT or F_EXIT or EDITABLE or RBUTTON)) or TOUCHEXIT;
  262.         IncAddr^.ob_flags:=(IncAddr^.ob_flags and not(SELECTABLE or DEFAULT or F_EXIT or EDITABLE or RBUTTON)) or TOUCHEXIT;
  263.         ObjAddr^.ob_flags:=(ObjAddr^.ob_flags and not(SELECTABLE or DEFAULT or F_EXIT or EDITABLE or RBUTTON)) or TOUCHEXIT;
  264.         Parent^.DlgTree^[ObjAddr^.ob_head].ob_flags:=(Parent^.DlgTree^[ObjAddr^.ob_head].ob_flags and not(SELECTABLE or DEFAULT or F_EXIT or EDITABLE or RBUTTON)) or TOUCHEXIT;
  265.         Size:=Max(1,TheSize);
  266.         PageMagnitude:=Size;
  267.         LineMagnitude:=1;
  268.         SPos:=-1;
  269.         Range:=Max(1,TheRange-1)+2;
  270.         SetRange(0,Range-2);
  271.         initflag:=false
  272.     end;
  273.  
  274.  
  275. function TScrollBar.TestIndex(AnIndx: integer): boolean;
  276.  
  277.     begin
  278.         TestIndex:=((AnIndx=ObjIndx) or (AnIndx=DecIndx) or (AnIndx=IncIndx) or
  279.                     (AnIndx=ObjAddr^.ob_head))
  280.     end;
  281.  
  282.  
  283. function TScrollBar.Transfer(DataPtr: pointer; TransferFlag: word): word;
  284.  
  285.     begin
  286.         case TransferFlag of
  287.             tf_SetData: with PScrollBarTransferRec(DataPtr)^ do
  288.                                         begin
  289.                                             SetRange(LowValue,HighValue);
  290.                                             SetPosition(Position)
  291.                                         end;
  292.             tf_GetData: with PScrollBarTransferRec(DataPtr)^ do
  293.                                         begin
  294.                                             LowValue:=lowval;
  295.                                             HighValue:=highval;
  296.                                             Position:=GetPosition
  297.                                         end
  298.         end;
  299.         Transfer:=sizeof(TScrollBarTransferRec)
  300.     end;
  301.  
  302.  
  303. procedure TScrollBar.Changed(AnIndx: integer; DblClick: boolean);
  304.     var sp,dif           : longint;
  305.         mx,my,ox,oy,px,py: integer;
  306.         less             : boolean;
  307.  
  308.     begin
  309.         sp:=SPos;
  310.         if AnIndx=DecIndx then
  311.             begin
  312.                 if DblClick then sp:=0
  313.                 else
  314.                     dec(sp,LineMagnitude)
  315.             end
  316.         else
  317.             if AnIndx=IncIndx then
  318.                 begin
  319.                     if DblClick then sp:=Range
  320.                     else
  321.                         inc(sp,LineMagnitude)
  322.                 end
  323.             else
  324.                 if AnIndx=ObjIndx then
  325.                     begin
  326.                         graf_mkstate(mx,my,ox,ox);
  327.                         objc_offset(Parent^.DlgTree,ObjAddr^.ob_head,ox,oy);
  328.                         if IsHorizontal then less:=(mx<ox)
  329.                         else
  330.                             less:=(my<oy);
  331.                         if less then
  332.                             begin
  333.                                 if DblClick then sp:=0
  334.                                 else
  335.                                     dec(sp,PageMagnitude)
  336.                             end
  337.                         else
  338.                             begin
  339.                                 if DblClick then sp:=Range
  340.                                 else
  341.                                     inc(sp,PageMagnitude)
  342.                             end
  343.                     end
  344.                 else
  345.                     begin
  346.                         objc_offset(Parent^.DlgTree,ObjAddr^.ob_head,ox,oy);
  347.                         objc_offset(Parent^.DlgTree,ObjIndx,px,py);
  348.                         wind_update(BEG_UPDATE);
  349.                         graf_dragbox(Parent^.DlgTree^[ObjAddr^.ob_head].ob_width,Parent^.DlgTree^[ObjAddr^.ob_head].ob_height,ox,oy,px,py,ObjAddr^.ob_width,ObjAddr^.ob_height,mx,my);
  350.                         if (mx<>ox) or (my<>oy) then
  351.                             begin
  352.                                 dif:=Max(0,Range-Size);
  353.                                 if IsHorizontal then
  354.                                     begin
  355.                                         ox:=ObjAddr^.ob_width-Parent^.DlgTree^[ObjAddr^.ob_head].ob_width;
  356.                                         if ox<1 then sp:=0
  357.                                         else
  358.                                             sp:=((mx-px)*dif) div ox;
  359.                                     end
  360.                                 else
  361.                                     begin
  362.                                         oy:=ObjAddr^.ob_height-Parent^.DlgTree^[ObjAddr^.ob_head].ob_height;
  363.                                         if oy<1 then sp:=0
  364.                                         else
  365.                                             sp:=((my-py)*dif) div oy;
  366.                                     end
  367.                             end;
  368.                         wind_update(END_UPDATE)
  369.                     end;
  370.         SetPosition(sp+lowval)
  371.     end;
  372.  
  373.  
  374. procedure TScrollBar.Work;
  375.  
  376.     begin
  377.     end;
  378.  
  379.  
  380. procedure TScrollBar.SetPosition(ThumbPos: longint);
  381.     var dif: longint;
  382.  
  383.     begin
  384.         dec(ThumbPos,lowval);
  385.         dif:=Range-Size;
  386.         if ThumbPos+Size>Range then ThumbPos:=dif;
  387.         if ThumbPos<0 then ThumbPos:=0;
  388.         if SPos<>ThumbPos then
  389.             begin
  390.                 SPos:=ThumbPos;
  391.                 if dif<1 then dif:=1;
  392.                 if IsHorizontal then
  393.                     Parent^.DlgTree^[ObjAddr^.ob_head].ob_x:=((ObjAddr^.ob_width-Parent^.DlgTree^[ObjAddr^.ob_head].ob_width)*SPos) div dif
  394.                 else
  395.                     Parent^.DlgTree^[ObjAddr^.ob_head].ob_y:=((ObjAddr^.ob_height-Parent^.DlgTree^[ObjAddr^.ob_head].ob_height)*SPos) div dif;
  396.                 if not(initflag) then
  397.                     begin
  398.                         Paint;
  399.                         Work
  400.                     end
  401.             end
  402.     end;
  403.  
  404.  
  405. function TScrollBar.GetPosition: longint;
  406.  
  407.     begin
  408.         GetPosition:=SPos+lowval
  409.     end;
  410.  
  411.  
  412. function TScrollBar.DeltaPos(Delta: longint): longint;
  413.  
  414.     begin
  415.         if Delta<>0 then SetPosition(SPos+lowval+Delta);
  416.         DeltaPos:=SPos+lowval
  417.     end;
  418.  
  419.  
  420. procedure TScrollBar.SetRange(LoVal,HiVal: longint);
  421.     var sp,s,TheRange: longint;
  422.  
  423.     begin
  424.         TheRange:=HiVal+1-LoVal;
  425.         if TheRange<1 then
  426.             begin
  427.                 HiVal:=LoVal+1;
  428.                 TheRange:=1
  429.             end;
  430.         lowval:=LoVal;
  431.         highval:=HiVal;
  432.         if Range<>TheRange then
  433.             begin
  434.                 Range:=TheRange;
  435.                 if IsHorizontal then
  436.                     begin
  437.                         s:=(ObjAddr^.ob_width*Size) div Range;
  438.                         if s>ObjAddr^.ob_width then s:=ObjAddr^.ob_width;
  439.                         if s<GetSBoxMin then s:=GetSBoxMin;
  440.                         Parent^.DlgTree^[ObjAddr^.ob_head].ob_width:=s
  441.                     end
  442.                 else
  443.                     begin
  444.                         s:=(ObjAddr^.ob_height*Size) div Range;
  445.                         if s>ObjAddr^.ob_height then s:=ObjAddr^.ob_height;
  446.                         if s<GetSBoxMin then s:=GetSBoxMin;
  447.                         Parent^.DlgTree^[ObjAddr^.ob_head].ob_height:=s
  448.                     end;
  449.                 sp:=SPos;
  450.                 SetPosition(SPos+lowval);
  451.                 if sp=SPos then
  452.                     if not(initflag) then
  453.                         begin
  454.                             Paint;
  455.                             Work
  456.                         end
  457.             end
  458.     end;
  459.  
  460.  
  461. function TScrollBar.GetRange(var LoVal,HiVal: longint): longint;
  462.  
  463.     begin
  464.         LoVal:=lowval;
  465.         HiVal:=highval;
  466.         GetRange:=Range+1
  467.     end;
  468.  
  469.  
  470. function TScrollBar.GetSBoxMin: integer;
  471.  
  472.     begin
  473.         GetSBoxMin:=8
  474.     end;
  475.  
  476. { *** TSCROLLBAR *** }
  477.  
  478.  
  479.  
  480. { *** Objekt TGROUPBOX *** }
  481.  
  482. constructor TGroupBox.Init(AParent: PDialog; AnIndx: integer; ATitle,Hlp: string);
  483.  
  484.     begin
  485.         if not(inherited Init(AParent,AnIndx,Hlp)) then fail;
  486.         Style:=cs_GroupBox or gbs_Recessed;
  487.         Title:=NewStr(ATitle);
  488.         if ((ObjAddr^.ob_type and $ff)=G_BOX) and (Title<>nil) then
  489.             with ObjAddr^ do
  490.                 begin
  491.                     oldflags:=ob_flags;
  492.                     oldobspec:=ob_spec.index;
  493.                     UsrBlk.ub_parm:=longint(Title);
  494.                     UsrBlk.ub_code:=@DrawGroupBox;
  495.                     ob_flags:=ob_flags and not(RBUTTON or EDITABLE or SELECTABLE or DEFAULT or F_EXIT or TOUCHEXIT);
  496.                     ob_type:=G_USERDEF;
  497.                     ob_spec.user_blk:=@UsrBlk;
  498.                     UsrDef:=true
  499.                 end
  500.         else
  501.             begin
  502.                 DisposeStr(Title);
  503.                 inherited Done;
  504.                 fail
  505.             end
  506.     end;
  507.  
  508.  
  509. destructor TGroupBox.Done;
  510.  
  511.     begin
  512.         with ObjAddr^ do
  513.             begin
  514.                 ob_spec.index:=oldobspec;
  515.                 ob_type:=G_BOX;
  516.                 ob_flags:=oldflags
  517.             end;
  518.         DisposeStr(Title);
  519.         inherited Done
  520.     end;
  521.  
  522.  
  523. procedure TGroupBox.SetText(ATextString: string);
  524.     var nt: PString;
  525.  
  526.     begin
  527.         nt:=NewStr(ATextString);
  528.         if nt<>nil then
  529.             begin
  530.                 DisposeStr(Title);
  531.                 Title:=nt;
  532.                 UsrBlk.ub_parm:=longint(Title);
  533.                 Paint
  534.             end
  535.     end;
  536.  
  537.  
  538. function TGroupBox.GetText: string;
  539.  
  540.     begin
  541.         if Title<>nil then GetText:=Title^ else GetText:=''
  542.     end;
  543.  
  544. { *** TGROUPBOX ***}
  545.  
  546.  
  547.  
  548. { *** Objekt TCHECKBOX *** }
  549.  
  550. constructor TCheckBox.Init(AParent: PDialog; AnIndx: integer; UserDef: boolean; Hlp: string);
  551.  
  552.     begin
  553.         if not(inherited Init(AParent,AnIndx,id_No,UserDef,Hlp)) then fail;
  554.         EnableTransfer;
  555.         Style:=cs_CheckBox;
  556.         if UsrDef then
  557.             with ObjAddr^ do
  558.                 begin
  559.                     ob_type:=ob_type and cbAll;
  560.                     if bTst(ob_state,SELECTED) then ob_type:=ob_type or cbChecked
  561.                     else
  562.                         ob_type:=ob_type or cbUnchecked
  563.                 end
  564.     end;
  565.  
  566.  
  567. function TCheckBox.Install: boolean;
  568.  
  569.     begin
  570.         with ObjAddr^ do
  571.             if (ob_type and $ff)=G_BUTTON then
  572.                 begin
  573.                     UsrBlk.ub_parm:=ob_spec.index;
  574.                     UsrBlk.ub_code:=@DrawCheckBox;
  575.                     ob_flags:=(ob_flags and not(RBUTTON or EDITABLE)) or SELECTABLE;
  576.                     ob_state:=ob_state and not(CHECKED or OUTLINED or SHADOWED);
  577.                     ob_type:=G_USERDEF;
  578.                     ob_spec.user_blk:=@UsrBlk
  579.                 end
  580.             else
  581.                 UsrDef:=false;
  582.         Install:=true
  583.     end;
  584.  
  585.  
  586. procedure TCheckBox.Deinstall;
  587.  
  588.     begin
  589.     end;
  590.  
  591.  
  592. function TCheckBox.Transfer(DataPtr: pointer; TransferFlag: word): word;
  593.  
  594.     begin
  595.         case TransferFlag of
  596.             tf_SetData: SetCheck(PWord(DataPtr)^);
  597.             tf_GetData: PWord(DataPtr)^:=GetCheck
  598.         end;
  599.         Transfer:=2
  600.     end;
  601.  
  602.  
  603. procedure TCheckBox.SetCheck(CheckFlag: integer);
  604.  
  605.     begin
  606.         if CheckFlag=bf_Grayed then
  607.             if not(bTst(Style,cs_3State)) then CheckFlag:=bf_Unchecked;
  608.         if GetCheck<>CheckFlag then
  609.             begin
  610.                 with ObjAddr^ do
  611.                     if UsrDef then
  612.                         case CheckFlag of
  613.                             bf_Unchecked: begin
  614.                                                             ob_type:=(ob_type and not(cbFlags)) or cbUnchecked;
  615.                                                             ob_state:=ob_state and not(SELECTED)
  616.                                                         end;
  617.                             bf_Checked:   begin
  618.                                                             ob_type:=(ob_type and not(cbFlags)) or cbChecked;
  619.                                                             ob_state:=ob_state or SELECTED
  620.                                                         end;
  621.                             bf_Grayed:    ob_type:=ob_type or cbGrayed
  622.                         end
  623.                     else
  624.                         case CheckFlag of
  625.                             bf_Unchecked: ob_state:=ob_state and not(SELECTED)
  626.                         else
  627.                             ob_state:=ob_state or SELECTED
  628.                         end;
  629.                 Paint
  630.             end
  631.     end;
  632.  
  633.  
  634. function TCheckBox.GetCheck: integer;
  635.  
  636.     begin
  637.         with ObjAddr^ do
  638.             if UsrDef then
  639.                 case (ob_type and cbFlags) of
  640.                     cbUnChecked: GetCheck:=bf_Unchecked;
  641.                     cbChecked  : GetCheck:=bf_Checked;
  642.                     cbGrayed   : GetCheck:=bf_Grayed
  643.                 else
  644.                     GetCheck:=bf_Unchecked
  645.                 end
  646.             else
  647.                 begin
  648.                     if bTst(ob_state,SELECTED) then GetCheck:=bf_Checked
  649.                     else
  650.                         GetCheck:=bf_Unchecked
  651.                 end
  652.     end;
  653.  
  654.  
  655. procedure TCheckBox.Check;
  656.  
  657.     begin
  658.         SetCheck(bf_Checked)
  659.     end;
  660.  
  661.  
  662. procedure TCheckBox.Uncheck;
  663.  
  664.     begin
  665.         SetCheck(bf_Unchecked)
  666.     end;
  667.  
  668.  
  669. procedure TCheckBox.Toggle;
  670.  
  671.     begin
  672.         case GetCheck of
  673.             bf_Unchecked: SetCheck(bf_Checked);
  674.             bf_Checked:   SetCheck(bf_Grayed);
  675.             bf_Grayed:    SetCheck(bf_Unchecked)
  676.         end
  677.     end;
  678.  
  679. { *** TCHECKBOX *** }
  680.  
  681.  
  682.  
  683. { *** Objekt TTRISTATE *** }
  684.  
  685. constructor TTriState.Init(AParent: PDialog; AnIndx: integer; Hlp: string);
  686.  
  687.     begin
  688.         if not(inherited Init(AParent,AnIndx,true,Hlp)) then fail;
  689.         Style:=cs_3State;
  690.         with ObjAddr^ do ob_type:=ob_type or cbType
  691.     end;
  692.  
  693.  
  694. procedure TTriState.Gray;
  695.  
  696.     begin
  697.         SetCheck(bf_Grayed)
  698.     end;
  699.  
  700. { *** TTRISTATE ***}
  701.  
  702.  
  703.  
  704. { *** Objekt TRADIOBUTTON *** }
  705.  
  706. constructor TRadioButton.Init(AParent: PDialog; AnIndx: integer; UserDef: boolean; Hlp: string);
  707.  
  708.     begin
  709.         if not(inherited Init(AParent,AnIndx,UserDef,Hlp)) then fail;
  710.         Style:=cs_RadioButton
  711.     end;
  712.  
  713.  
  714. procedure TRadioButton.SetState(StateFlag: integer);
  715.  
  716.     begin
  717.         if GetState<>StateFlag then
  718.             begin
  719.                 if StateFlag=bf_Disabled then Uncheck;
  720.                 inherited SetState(StateFlag)
  721.             end
  722.     end;
  723.  
  724.  
  725. function TRadioButton.Install: boolean;
  726.  
  727.     begin
  728.         with ObjAddr^ do
  729.             if (ob_type and $ff)=G_BUTTON then
  730.                 begin
  731.                     UsrBlk.ub_parm:=ob_spec.index;
  732.                     UsrBlk.ub_code:=@DrawRadioButton;
  733.                     ob_flags:=(ob_flags and not(EDITABLE)) or RBUTTON or SELECTABLE;
  734.                     ob_state:=ob_state and not(CROSSED or CHECKED or OUTLINED or SHADOWED);
  735.                     ob_type:=G_USERDEF;
  736.                     ob_spec.user_blk:=@UsrBlk
  737.                 end
  738.             else
  739.                 UsrDef:=false;
  740.         Install:=true
  741.     end;
  742.  
  743. { *** TRADIOBUTTON *** }
  744.  
  745.  
  746.  
  747. { *** Objekt TCOMBOBOX *** }
  748.  
  749. constructor TComboBox.Init(AParent: PDialog; AnIndx,CycleIndx,TitleIndx,ptIndx,popIndx: integer; Cycle,Editable: boolean; Hlp: string);
  750.     var ot   : integer;
  751.         txt  : string;
  752.  
  753.     begin
  754.         if not(inherited Init(AParent,AnIndx,Hlp)) then fail;
  755.         initflag:=true;
  756.         if Editable then Edit:=GetEdit
  757.         else
  758.             Edit:=nil;
  759.         cindx:=CycleIndx;
  760.         if cindx>0 then caddr:=@Parent^.DlgTree^[cindx]
  761.         else
  762.             caddr:=nil;
  763.         tindx:=TitleIndx;
  764.         if tindx>0 then
  765.             begin
  766.                 taddr:=@Parent^.DlgTree^[tindx];
  767.                 if taddr<>nil then
  768.                     with taddr^ do
  769.                         begin
  770.                             ob_flags:=ob_flags or SELECTABLE;
  771.                             if bTst(Application^.Attr.Style,as_3DFlags) then ob_flags:=ob_flags or FL3DBAK
  772.                             else
  773.                                 ob_flags:=ob_flags and not(FL3DBAK);
  774.                             ot:=ob_type and $ff;
  775.                             if (ot=G_BUTTON) or (ot=G_STRING) or (ot=G_TITLE) then
  776.                                 begin
  777.                                     txt:=StrPas(ob_spec.free_string);
  778.                                     usrtblk.ub_parm:=longint(ob_spec.free_string)
  779.                                 end
  780.                             else
  781.                                 if (ot=G_TEXT) or (ot=G_FTEXT) or (ot=G_BOXTEXT) or (ot=G_FBOXTEXT) then
  782.                                     begin
  783.                                         txt:=StrPas(ob_spec.ted_info^.te_ptext);
  784.                                         usrtblk.ub_parm:=longint(ob_spec.ted_info^.te_ptext)
  785.                                     end
  786.                                 else
  787.                                     begin
  788.                                         txt:='';
  789.                                         usrtblk.ub_parm:=0
  790.                                     end;
  791.                             ot:=pos('&',txt);
  792.                             if (ot>0) and (ot<length(txt)) then SetShortCut(txt[ot+1]);
  793.                             oldttype:=ob_type;
  794.                             oldtobspec:=ob_spec.index;
  795.                             usrtblk.ub_code:=@DrawComboTitle;
  796.                             ob_spec.user_blk:=@usrtblk;
  797.                             ob_type:=G_USERDEF
  798.                         end
  799.             end
  800.         else
  801.             taddr:=nil;
  802.         pindx:=popIndx;
  803.         tpindx:=ptIndx;
  804.         cycl:=Cycle;
  805.         EnableTransfer;
  806.         Style:=cs_ComboBox;
  807.         ID:=id_NoExit;
  808.         Popup:=nil;
  809.         select:=id_No;
  810.         if Edit=nil then
  811.             with ObjAddr^ do
  812.                 ob_flags:=(ob_flags and not(SELECTABLE or F_EXIT)) or TOUCHEXIT;
  813.         if caddr<>nil then
  814.             with caddr^ do
  815.                 begin
  816.                     if cycl then
  817.                         begin
  818.                             ob_flags:=(ob_flags and not(SELECTABLE or F_EXIT)) or TOUCHEXIT;
  819.                             UsrBlk.ub_parm:=ob_spec.index;
  820.                             UsrBlk.ub_code:=@DrawCycleBox;
  821.                             oldtype:=ob_type;
  822.                             ob_type:=G_USERDEF;
  823.                             ob_spec.user_blk:=@UsrBlk;
  824.                             UsrDef:=true
  825.                         end
  826.                     else
  827.                         begin
  828.                             ob_flags:=(ob_flags and not(TOUCHEXIT)) or SELECTABLE or F_EXIT;
  829.                             if (ob_type and $ff)=G_BOXCHAR then
  830.                                 ob_spec.index:=(ob_spec.index and $00ffffff) or (longint(ord(Application^.Attr.PopChar)) shl 24)
  831.                         end
  832.                 end;
  833.         SetSelection(0);
  834.         initflag:=false
  835.     end;
  836.  
  837.  
  838. destructor TComboBox.Done;
  839.  
  840.     begin
  841.         if Popup<>nil then
  842.             with Popup^ do
  843.                 begin
  844.                     Uncheck(select);
  845.                     Free
  846.                 end;
  847.         if taddr<>nil then
  848.             with taddr^ do
  849.                 begin
  850.                     ob_type:=oldttype;
  851.                     ob_spec.index:=oldtobspec
  852.                 end;
  853.         if UsrDef then
  854.             with caddr^ do
  855.                 begin
  856.                     ob_spec.index:=UsrBlk.ub_parm;
  857.                     ob_type:=oldtype
  858.                 end;
  859.         inherited Done
  860.     end;
  861.  
  862.  
  863. function TComboBox.TestIndex(AnIndx: integer): boolean;
  864.  
  865.     begin
  866.         TestIndex:=(((AnIndx=ObjIndx) and (Edit=nil)) or (AnIndx=cindx) or (AnIndx=tindx))
  867.     end;
  868.  
  869.  
  870. function TComboBox.Transfer(DataPtr: pointer; TransferFlag: word): word;
  871.     var offs: word;
  872.  
  873.     begin
  874.         if Edit<>nil then
  875.             begin
  876.                 offs:=Edit^.Transfer(DataPtr,TransferFlag);
  877.                 inc(longint(DataPtr),offs)
  878.             end
  879.         else
  880.             offs:=0;
  881.         case TransferFlag of
  882.         tf_SetData:
  883.             SetSelection(PWord(DataPtr)^);
  884.         tf_GetData:
  885.             PWord(DataPtr)^:=GetSelection
  886.         end;
  887.         Transfer:=offs+2
  888.     end;
  889.  
  890.  
  891. procedure TComboBox.Changed(AnIndx: integer; DblClick: boolean);
  892.     var res,xof,yof: integer;
  893.  
  894.     begin
  895.         if AnIndx=cindx then
  896.             begin
  897.                 if cycl then
  898.                     begin
  899.                         if (kbshift(-1) and K_SHIFT)>0 then SetSelection(select-1)
  900.                         else
  901.                             SetSelection(select+1);
  902.                         exit
  903.                     end
  904.                 else
  905.                     if caddr<>nil then
  906.                         if not(bTst(caddr^.ob_state,SELECTED)) then exit
  907.             end;
  908.         SetSelection(select);
  909.         if Popup=nil then exit;
  910.         if tindx>0 then
  911.             with Parent^ do
  912.                 begin
  913.                     DlgTree^[tindx].ob_state:=DlgTree^[tindx].ob_state or SELECTED;
  914.                     ObjcPaint(tindx,false)
  915.                 end;
  916.         if not(cycl) then
  917.             if AnIndx=tindx then
  918.                 if caddr<>nil then
  919.                     begin
  920.                         with caddr^ do ob_state:=ob_state or SELECTED;
  921.                         Parent^.ObjcPaint(cindx,false)
  922.                     end;
  923.         objc_offset(Parent^.DlgTree,ObjIndx,xof,yof);
  924.         with Popup^ do
  925.             begin
  926.                 pX:=xof;
  927.                 if AnIndx=ObjIndx then pY:=yof-select*PopTree^[PopTree^[pIndex].ob_head].ob_height
  928.                 else
  929.                     begin
  930.                         pY:=yof+ObjAddr^.ob_height+2;
  931.                         if PopTree^[pIndex].ob_height+pY>Application^.Attr.MaxPY then pY:=yof-PopTree^[pIndex].ob_height-2
  932.                     end;
  933.                 res:=Execute
  934.             end;
  935.         if not(cycl) then
  936.             if AnIndx=tindx then
  937.                 if caddr<>nil then
  938.                     begin
  939.                         with caddr^ do ob_state:=ob_state and not(SELECTED);
  940.                         Parent^.ObjcPaint(cindx,false)
  941.                     end;
  942.         if res>=0 then SetSelection(res);
  943.         if tindx>0 then
  944.             begin
  945.                 with Parent^.DlgTree^[tindx] do ob_state:=ob_state and not(SELECTED);
  946.                 Paint
  947.             end
  948.     end;
  949.  
  950.  
  951. procedure TComboBox.Work;
  952.  
  953.     begin
  954.     end;
  955.  
  956.  
  957. procedure TComboBox.SetText(ATextString: string);
  958.     var typ: integer;
  959.         adr: PChar;
  960.  
  961.     begin
  962.         StrPTrim(ATextString);
  963.         if Edit<>nil then Edit^.SetText(ATextString)
  964.         else
  965.             begin
  966.                 adr:=nil;
  967.                 typ:=ObjAddr^.ob_type and $ff;
  968.                 if (typ=G_BUTTON) or (typ=G_STRING) or (typ=G_TITLE) then adr:=ObjAddr^.ob_spec.free_string;
  969.                 if adr<>nil then StrPCopy(adr,ATextString)
  970.                 else
  971.                     if (typ=G_TEXT) or (typ=G_BOXTEXT) or (typ=G_FTEXT) or (typ=G_FBOXTEXT) then
  972.                         StrPCopy(ObjAddr^.ob_spec.ted_info^.te_ptext,ATextString)
  973.             end;
  974.         Paint
  975.     end;
  976.  
  977.  
  978. function TComboBox.GetText: string;
  979.     var typ: integer;
  980.  
  981.     begin
  982.         if Edit<>nil then GetText:=Edit^.GetText
  983.         else
  984.             begin
  985.                 typ:=ObjAddr^.ob_type and $ff;
  986.                 if (typ=G_BUTTON) or (typ=G_STRING) or (typ=G_TITLE) then GetText:=StrPas(ObjAddr^.ob_spec.free_string)
  987.                 else
  988.                     if (typ=G_TEXT) or (typ=G_BOXTEXT) or (typ=G_FTEXT) or (typ=G_FBOXTEXT) then
  989.                         GetText:=StrPas(ObjAddr^.ob_spec.ted_info^.te_ptext)
  990.                     else
  991.                         GetText:=''
  992.             end
  993.     end;
  994.  
  995.  
  996. procedure TComboBox.Paint;
  997.  
  998.     begin
  999.         if tindx>0 then Parent^.ObjcPaint(tindx,false);
  1000.         if Edit<>nil then Edit^.Paint
  1001.         else
  1002.             inherited Paint;
  1003.         if cindx>0 then Parent^.ObjcPaint(cindx,false)
  1004.     end;
  1005.  
  1006.  
  1007. function TComboBox.GetSelection: integer;
  1008.  
  1009.     begin
  1010.         GetSelection:=select
  1011.     end;
  1012.  
  1013.  
  1014. procedure TComboBox.SetSelection(Sel: integer);
  1015.     var i,direc: integer;
  1016.  
  1017.     begin
  1018.         if Popup=nil then
  1019.             begin
  1020.                 new(Popup,Init(Parent,tpindx,pindx));
  1021.                 if Popup=nil then exit
  1022.             end;
  1023.         if Sel<0 then
  1024.             begin
  1025.                 Sel:=Popup^.pMax-1;
  1026.                 direc:=-1;
  1027.                 i:=Sel
  1028.             end
  1029.         else
  1030.             begin
  1031.                 direc:=1;
  1032.                 i:=0
  1033.             end;
  1034.         if Sel>=Popup^.pMax then sel:=0;
  1035.         if Popup^.GetState(Sel)=bf_Disabled then
  1036.             begin
  1037.                 Sel:=id_No;
  1038.                 while (i>=0) and (i<Popup^.pMax) do
  1039.                     if Popup^.GetCheck(i)=bf_Disabled then inc(i,direc)
  1040.                     else
  1041.                         begin
  1042.                             Sel:=i;
  1043.                             break
  1044.                         end
  1045.             end;
  1046.         if Sel<>select then
  1047.             begin
  1048.                 Popup^.Uncheck(select);
  1049.                 select:=Sel;
  1050.                 Popup^.Check(select);
  1051.                 SetText(Popup^.GetText(select));
  1052.                 if not(initflag) then Work
  1053.             end
  1054.     end;
  1055.  
  1056.  
  1057. function TComboBox.GetEdit: PEdit;
  1058.  
  1059.     begin
  1060.         GetEdit:=new(PEdit,Init(Parent,ObjIndx,-1,GetHelp))
  1061.     end;
  1062.  
  1063. { *** TCOMBOBOX *** }
  1064.  
  1065.  
  1066.  
  1067. { *** Objekt TNOTEPAD *** }
  1068.  
  1069. constructor TNotepad.Init(AParent: PDialog; AnIndx,PadIndx,AGroup: integer; Hlp: string);
  1070.  
  1071.     begin
  1072.         if not(inherited Init(AParent,AnIndx,Hlp)) then fail;
  1073.         pad:=PadIndx;
  1074.         if pad>0 then paddr:=@Parent^.DlgTree^[pad]
  1075.         else
  1076.             paddr:=nil;
  1077.         if paddr=nil then
  1078.             begin
  1079.                 inherited Done;
  1080.                 fail
  1081.             end;
  1082.         Style:=cs_Notepad;
  1083.         group:=AGroup;
  1084.         { ... }
  1085.     end;
  1086.  
  1087. { *** TNOTEPAD *** }
  1088.  
  1089.  
  1090.  
  1091.  
  1092. function DrawCycleBox(dummy1,dummy2: pointer; parm: PARMBLKPtr): word;
  1093.     var clip: ARRAY_4;
  1094.         br  : integer;
  1095.  
  1096.     begin
  1097.         InitVWrk;
  1098.         with parm^ do
  1099.             begin
  1100.                 clip[0]:=pb_xc;
  1101.                 clip[1]:=pb_yc;
  1102.                 clip[2]:=pb_xc+pb_wc-1;
  1103.                 clip[3]:=pb_yc+pb_hc-1;
  1104.                 vs_clip(Application^.vdiHandle,CLIP_ON,clip);
  1105.                 clip[0]:=pb_x;
  1106.                 clip[1]:=pb_y;
  1107.                 clip[2]:=pb_x+pb_w+1;
  1108.                 clip[3]:=pb_y+pb_h+2
  1109.             end;
  1110.         with Application^ do
  1111.             begin
  1112.                 vsf_interior(vdiHandle,FIS_SOLID);
  1113.                 vsf_color(vdiHandle,Black);
  1114.                 v_bar(vdiHandle,clip);
  1115.                 dec(clip[2],3);
  1116.                 dec(clip[3],3);
  1117.                 vsf_color(vdiHandle,White);
  1118.                 v_bar(vdiHandle,clip);
  1119.                 pxya[0]:=clip[0];
  1120.                 pxya[1]:=clip[1]-1;
  1121.                 pxya[2]:=clip[2]+1;
  1122.                 pxya[3]:=pxya[1];
  1123.                 pxya[4]:=pxya[2];
  1124.                 pxya[5]:=clip[3]+1;
  1125.                 pxya[6]:=pxya[0];
  1126.                 pxya[7]:=pxya[5];
  1127.                 v_pline(vdiHandle,4,pxya);
  1128.                 vsf_color(vdiHandle,LBlack);
  1129.                 br:=clip[2]-clip[0]-5;
  1130.                 pxya[0]:=clip[0]+3;
  1131.                 pxya[1]:=((clip[1]+clip[3]) shr 1)-1;
  1132.                 pxya[2]:=pxya[0]+(br shr 1);
  1133.                 pxya[3]:=clip[1]+2;
  1134.                 pxya[4]:=pxya[0]+br-1;
  1135.                 pxya[5]:=pxya[1];
  1136.                 pxya[6]:=pxya[0];
  1137.                 pxya[7]:=pxya[1];
  1138.                 v_fillarea(vdiHandle,4,pxya);
  1139.                 inc(pxya[1],3);
  1140.                 pxya[3]:=clip[3]-2;
  1141.                 pxya[5]:=pxya[1];
  1142.                 pxya[7]:=pxya[1];
  1143.                 v_fillarea(vdiHandle,4,pxya)
  1144.             end;
  1145.         RestoreVWrk;
  1146.         DrawCycleBox:=NORMAL
  1147.     end;
  1148.  
  1149.  
  1150. function DrawGroupBox(dummy1,dummy2: pointer; parm: PARMBLKPtr): word;
  1151.     var clip: ARRAY_4;
  1152.  
  1153.     begin
  1154.         InitVWrk;
  1155.         with parm^ do
  1156.             begin
  1157.                 clip[0]:=pb_xc;
  1158.                 clip[1]:=pb_yc;
  1159.                 clip[2]:=pb_xc+pb_wc-1;
  1160.                 clip[3]:=pb_yc+pb_hc-1;
  1161.                 vs_clip(Application^.vdiHandle,CLIP_ON,clip);
  1162.                 clip[0]:=pb_x;
  1163.                 clip[1]:=pb_y;
  1164.                 clip[2]:=pb_x+pb_w-1;
  1165.                 clip[3]:=pb_y+pb_h-1
  1166.             end;
  1167.         with Application^ do
  1168.             begin
  1169.                 vsf_interior(vdiHandle,FIS_SOLID);
  1170.                 vsf_color(vdiHandle,SysInfo.BGDefCol);
  1171.                 v_bar(vdiHandle,clip);
  1172.                 if (SysInfo.BGDefCol<>White) and (Attr.Colors>=LBlack) and bTst(Attr.Style,as_3DFlags) then
  1173.                     begin
  1174.                         { gbs_Recessed... }
  1175.                         pxya[0]:=clip[0];
  1176.                         pxya[1]:=clip[3];
  1177.                         pxya[2]:=clip[0];
  1178.                         pxya[3]:=clip[1];
  1179.                         pxya[4]:=clip[2];
  1180.                         pxya[5]:=clip[1];
  1181.                         gem.vsl_color(vdiHandle,LBlack);
  1182.                         v_pline(vdiHandle,3,pxya);
  1183.                         pxya[0]:=clip[0]+1;
  1184.                         pxya[1]:=clip[3];
  1185.                         pxya[2]:=clip[2];
  1186.                         pxya[3]:=clip[3];
  1187.                         pxya[4]:=clip[2];
  1188.                         pxya[5]:=clip[1]+1;
  1189.                         gem.vsl_color(vdiHandle,White);
  1190.                         v_pline(vdiHandle,3,pxya)
  1191.                     end
  1192.                 else
  1193.                     begin
  1194.                         vsf_interior(vdiHandle,FIS_HOLLOW);
  1195.                         vsf_color(vdiHandle,Black);
  1196.                         vswr_mode(vdiHandle,MD_TRANS);
  1197.                         v_bar(vdiHandle,clip)
  1198.                     end;
  1199.                 if length(PString(parm^.pb_parm)^)>0 then
  1200.                     begin
  1201.                         gem.vswr_mode(vdiHandle,MD_ERASE);
  1202.                         gem.vst_color(vdiHandle,SysInfo.BGDefCol);
  1203.                         v_gtext(vdiHandle,parm^.pb_x+Attr.charSWidth,parm^.pb_y+(SysInfo.SFHeight shr 1),' '+PString(parm^.pb_parm)^+' ');
  1204.                         gem.vswr_mode(vdiHandle,MD_TRANS);
  1205.                         v_gtext(vdiHandle,parm^.pb_x+Attr.charSWidth,parm^.pb_y+(SysInfo.SFHeight shr 1),' '+PString(parm^.pb_parm)^+' ');
  1206.                         gem.vst_color(vdiHandle,Black);
  1207.                         v_gtext(vdiHandle,parm^.pb_x+Attr.charSWidth,parm^.pb_y+(SysInfo.SFHeight shr 1),' '+PString(parm^.pb_parm)^+' ')
  1208.                     end
  1209.             end;
  1210.         RestoreVWrk;
  1211.         DrawGroupBox:=NORMAL
  1212.     end;
  1213.  
  1214.  
  1215. function DrawCheckBox(dummy1,dummy2: pointer; parm: PARMBLKPtr): word;
  1216.     var clip            : ARRAY_4;
  1217.         tx,ty,scpos,stat: integer;
  1218.         q               : word;
  1219.         btn             : string[40];
  1220.  
  1221.     begin
  1222.         InitVWrk;
  1223.         with parm^ do
  1224.             begin
  1225.                 clip[0]:=pb_xc;
  1226.                 clip[1]:=pb_yc;
  1227.                 clip[2]:=pb_xc+pb_wc-1;
  1228.                 clip[3]:=pb_yc+pb_hc-1;
  1229.                 vs_clip(Application^.vdiHandle,CLIP_ON,clip);
  1230.                 clip[0]:=pb_x+1;
  1231.                 clip[1]:=pb_y+1;
  1232.                 clip[2]:=clip[0]+13;
  1233.                 clip[3]:=clip[1]+13;
  1234.                 case (pb_tree^[pb_obj].ob_type and cbFlags) of
  1235.                     cbChecked:   stat:=bf_Checked;
  1236.                     cbGrayed:    stat:=bf_Grayed
  1237.                 else
  1238.                     stat:=bf_Unchecked
  1239.                 end;
  1240.                 if pr_currstate<>pr_prevstate then
  1241.                     begin
  1242.                         inc(stat);
  1243.                         if bTst(pb_tree^[pb_obj].ob_type,cbType) then q:=3 else q:=2;
  1244.                         if stat>q then stat:=1;
  1245.                         case stat of
  1246.                             bf_Checked:   q:=cbChecked;
  1247.                             bf_Grayed:    q:=cbGrayed
  1248.                         else
  1249.                             q:=cbUnchecked
  1250.                         end;
  1251.                         pb_tree^[pb_obj].ob_type:=(pb_tree^[pb_obj].ob_type and not(cbFlags)) or q
  1252.                     end;
  1253.                 if (stat<>bf_Unchecked) or bTst(pr_currstate,CROSSED) then for q:=0 to 3 do inc(clip[q])
  1254.             end;
  1255.         with Application^ do
  1256.             begin
  1257.                 if stat=bf_Grayed then
  1258.                     begin
  1259.                         if Attr.Colors>=LWhite then
  1260.                             begin
  1261.                                 gem.vsf_interior(vdiHandle,FIS_SOLID);
  1262.                                 gem.vsf_color(vdiHandle,LWhite)
  1263.                             end
  1264.                         else
  1265.                             begin
  1266.                                 gem.vsf_interior(vdiHandle,FIS_PATTERN);
  1267.                                 gem.vsf_style(vdiHandle,1)
  1268.                             end
  1269.                     end;
  1270.                 v_bar(vdiHandle,clip);
  1271.                 if stat<>bf_Unchecked then
  1272.                     begin
  1273.                         pxya[0]:=clip[0]-1;
  1274.                         pxya[1]:=clip[3]-1;
  1275.                         pxya[2]:=clip[0]-1;
  1276.                         pxya[3]:=clip[1]-1;
  1277.                         pxya[4]:=clip[2]-1;
  1278.                         pxya[5]:=clip[1]-1;
  1279.                         gem.vsl_color(vdiHandle,SysInfo.BGDefCol);
  1280.                         v_pline(vdiHandle,3,pxya);
  1281.                         if stat=bf_Checked then
  1282.                             begin
  1283.                                 gem.vsl_color(vdiHandle,LBlack);
  1284.                                 if bTst(parm^.pr_currstate,CROSSED) then
  1285.                                     begin
  1286.                                         pxya[0]:=clip[0]+1;
  1287.                                         pxya[1]:=clip[1]+1;
  1288.                                         pxya[2]:=clip[2]-1;
  1289.                                         pxya[3]:=clip[3]-1;
  1290.                                         v_pline(vdiHandle,2,pxya);
  1291.                                         pxya[0]:=clip[0]+1;
  1292.                                         pxya[1]:=clip[3]-1;
  1293.                                         pxya[2]:=clip[2]-1;
  1294.                                         pxya[3]:=clip[1]+1;
  1295.                                         v_pline(vdiHandle,2,pxya)
  1296.                                     end
  1297.                                 else
  1298.                                     begin
  1299.                                         pxya[0]:=clip[0]+1;
  1300.                                         pxya[1]:=clip[3]-1;
  1301.                                         pxya[2]:=clip[0]+1;
  1302.                                         pxya[3]:=clip[1]+1;
  1303.                                         pxya[4]:=clip[2]-1;
  1304.                                         pxya[5]:=clip[1]+1;
  1305.                                         v_pline(vdiHandle,3,pxya);
  1306.                                         gem.vsf_interior(vdiHandle,FIS_SOLID);
  1307.                                         gem.vsf_color(vdiHandle,UDCOL);
  1308.                                         gem.vsl_color(vdiHandle,UDCOL);
  1309.                                         if bTst(parm^.pr_currstate,DISABLED) then
  1310.                                             if Attr.Colors>=LWhite then
  1311.                                                 begin
  1312.                                                     gem.vsf_color(vdiHandle,LWhite);
  1313.                                                     gem.vsl_color(vdiHandle,LWhite)
  1314.                                                 end;
  1315.                                         pxya[0]:=clip[0]+5;
  1316.                                         pxya[1]:=clip[1]+7;
  1317.                                         pxya[2]:=clip[0]+4;
  1318.                                         pxya[3]:=clip[1]+8;
  1319.                                         pxya[4]:=clip[0]+4;
  1320.                                         pxya[5]:=clip[1]+11;
  1321.                                         pxya[6]:=clip[0]+5;
  1322.                                         pxya[7]:=clip[1]+11;
  1323.                                         pxya[8]:=clip[0]+11;
  1324.                                         pxya[9]:=clip[1]+5;
  1325.                                         pxya[10]:=clip[0]+10;
  1326.                                         pxya[11]:=clip[1]+5;
  1327.                                         pxya[12]:=clip[0]+5;
  1328.                                         pxya[13]:=clip[1]+10;
  1329.                                         pxya[14]:=clip[0]+5;
  1330.                                         pxya[15]:=clip[1]+7;
  1331.                                         v_fillarea(vdiHandle,8,pxya)
  1332.                                     end
  1333.                             end
  1334.                         else
  1335.                             if Attr.Colors>=LWhite then
  1336.                                 begin
  1337.                                     pxya[0]:=clip[0];
  1338.                                     pxya[1]:=clip[1];
  1339.                                     pxya[2]:=clip[2];
  1340.                                     pxya[3]:=clip[1];
  1341.                                     pxya[4]:=clip[2];
  1342.                                     pxya[5]:=clip[3];
  1343.                                     pxya[6]:=clip[0];
  1344.                                     pxya[7]:=clip[3];
  1345.                                     pxya[8]:=clip[0];
  1346.                                     pxya[9]:=clip[1];
  1347.                                     gem.vsl_color(vdiHandle,Black);
  1348.                                     v_pline(vdiHandle,5,pxya)
  1349.                                 end
  1350.                     end
  1351.                 else
  1352.                     if not(bTst(parm^.pr_currstate,CROSSED)) then
  1353.                         begin
  1354.                             pxya[0]:=clip[0]+1;
  1355.                             pxya[1]:=clip[3]+1;
  1356.                             pxya[2]:=clip[2]+1;
  1357.                             pxya[3]:=clip[3]+1;
  1358.                             pxya[4]:=clip[2]+1;
  1359.                             pxya[5]:=clip[1]+1;
  1360.                             gem.vsl_color(vdiHandle,LBlack);
  1361.                             v_pline(vdiHandle,3,pxya)
  1362.                         end;
  1363.                 tx:=parm^.pb_x+14+Attr.charSWidth;
  1364.                 ty:=parm^.pb_y+SysInfo.SFHeight+1;
  1365.                 btn:=StrLPas(PChar(parm^.pb_parm),40);
  1366.                 while btn[length(btn)]=' ' do btn[0]:=chr(ord(btn[0])-1);
  1367.                 scpos:=pos('&',btn);
  1368.                 if scpos>0 then
  1369.                     begin
  1370.                         for q:=scpos to length(btn)-1 do btn[q]:=btn[q+1];
  1371.                         btn[0]:=chr(ord(btn[0])-1)
  1372.                     end;
  1373.                 gem.vswr_mode(vdiHandle,MD_ERASE);
  1374.                 gem.vst_color(vdiHandle,SysInfo.BGDefCol);
  1375.                 v_gtext(vdiHandle,tx,ty,btn);
  1376.                 gem.vswr_mode(vdiHandle,MD_TRANS);
  1377.                 v_gtext(vdiHandle,tx,ty,btn);
  1378.                 if bTst(parm^.pr_currstate,DISABLED) then gem.vst_effects(vdiHandle,TF_LIGHTENED);
  1379.                 gem.vst_color(vdiHandle,Black);
  1380.                 v_gtext(vdiHandle,tx,ty,btn);
  1381.                 if scpos>0 then
  1382.                     begin
  1383.                         if bTst(parm^.pr_currstate,DISABLED) then gem.vst_effects(vdiHandle,TF_UNDERLINED or TF_LIGHTENED)
  1384.                         else
  1385.                             begin
  1386.                                 gem.vst_effects(vdiHandle,TF_UNDERLINED);
  1387.                                 gem.vst_color(vdiHandle,HOTCOL)
  1388.                             end;
  1389.                         v_gtext(vdiHandle,tx+(scpos-1)*Attr.charSWidth,ty,' ')
  1390.                     end;
  1391.                 RestoreVWrk
  1392.             end;
  1393.         DrawCheckBox:=NORMAL
  1394.     end;
  1395.  
  1396.  
  1397. function DrawRadioButton(dummy1,dummy2: pointer; parm: PARMBLKPtr): word;
  1398.     var clip            : ARRAY_4;
  1399.         stat,tx,ty,scpos: integer;
  1400.         q               : word;
  1401.         btn             : string[40];
  1402.  
  1403.     begin
  1404.         with parm^ do
  1405.             begin
  1406.                 clip[0]:=pb_xc;
  1407.                 clip[1]:=pb_yc;
  1408.                 clip[2]:=pb_xc+pb_wc-1;
  1409.                 clip[3]:=pb_yc+pb_hc-1;
  1410.                 if (pb_tree^[pb_obj].ob_type and cbFlags)=cbChecked then stat:=bf_Checked
  1411.                 else
  1412.                     stat:=bf_Unchecked;
  1413.                 if pr_currstate<>pr_prevstate then
  1414.                     begin
  1415.                         stat:=stat xor 3;
  1416.                         if stat=bf_Checked then q:=cbChecked
  1417.                         else
  1418.                             q:=cbUnchecked;
  1419.                         pb_tree^[pb_obj].ob_type:=(pb_tree^[pb_obj].ob_type and not(cbFlags)) or q
  1420.                     end;
  1421.                 vs_clip(Application^.vdiHandle,CLIP_ON,clip);
  1422.                 InitVWrk;
  1423.                 pxya[0]:=pb_x+1;
  1424.                 pxya[1]:=pb_y+8;
  1425.                 pxya[2]:=pb_x+8;
  1426.                 pxya[3]:=pb_y+15;
  1427.                 pxya[4]:=pb_x+15;
  1428.                 pxya[5]:=pb_y+8;
  1429.                 pxya[6]:=pb_x+8;
  1430.                 pxya[7]:=pb_y+1;
  1431.                 pxya[8]:=pb_x+1;
  1432.                 pxya[9]:=pb_y+8
  1433.             end;
  1434.         if stat=bf_Checked then for q:=0 to 4 do inc(pxya[q shl 1]);
  1435.         with Application^ do
  1436.             begin
  1437.                 v_fillarea(vdiHandle,5,pxya);
  1438.                 gem.vsf_perimeter(vdiHandle,PER_ON);
  1439.                 if stat=bf_Checked then
  1440.                     begin
  1441.                         pxya[0]:=parm^.pb_x+8;
  1442.                         pxya[1]:=parm^.pb_y+1;
  1443.                         pxya[2]:=parm^.pb_x+1;
  1444.                         pxya[3]:=parm^.pb_y+8;
  1445.                         pxya[4]:=parm^.pb_x+8;
  1446.                         pxya[5]:=parm^.pb_y+15;
  1447.                         gem.vsl_color(vdiHandle,SysInfo.BGDefCol);
  1448.                         v_pline(vdiHandle,3,pxya);
  1449.                         pxya[0]:=parm^.pb_x+9;
  1450.                         pxya[1]:=parm^.pb_y+2;
  1451.                         pxya[2]:=parm^.pb_x+3;
  1452.                         pxya[3]:=parm^.pb_y+8;
  1453.                         pxya[4]:=parm^.pb_x+9;
  1454.                         pxya[5]:=parm^.pb_y+14;
  1455.                         gem.vsl_color(vdiHandle,LBlack);
  1456.                         v_pline(vdiHandle,3,pxya);
  1457.                         gem.vsf_interior(vdiHandle,FIS_SOLID);
  1458.                         gem.vsf_color(vdiHandle,UDCOL);
  1459.                         if bTst(parm^.pr_currstate,DISABLED) then
  1460.                             if Attr.Colors>=LWhite then
  1461.                                 begin
  1462.                                     gem.vsf_color(vdiHandle,LWhite);
  1463.                                     gem.vsl_color(vdiHandle,LWhite)
  1464.                                 end;
  1465.                         pxya[0]:=parm^.pb_x+7;
  1466.                         pxya[1]:=parm^.pb_y+8;
  1467.                         pxya[2]:=parm^.pb_x+9;
  1468.                         pxya[3]:=parm^.pb_y+10;
  1469.                         pxya[4]:=parm^.pb_x+11;
  1470.                         pxya[5]:=parm^.pb_y+8;
  1471.                         pxya[6]:=parm^.pb_x+9;
  1472.                         pxya[7]:=parm^.pb_y+6;
  1473.                         pxya[8]:=parm^.pb_x+7;
  1474.                         pxya[9]:=parm^.pb_y+8;
  1475.                         v_fillarea(vdiHandle,5,pxya)
  1476.                     end
  1477.                 else
  1478.                     begin
  1479.                         pxya[0]:=parm^.pb_x+9;
  1480.                         pxya[1]:=parm^.pb_y+1;
  1481.                         pxya[2]:=parm^.pb_x+16;
  1482.                         pxya[3]:=parm^.pb_y+8;
  1483.                         pxya[4]:=parm^.pb_x+9;
  1484.                         pxya[5]:=parm^.pb_y+15;
  1485.                         gem.vsl_color(vdiHandle,LBlack);
  1486.                         v_pline(vdiHandle,3,pxya)
  1487.                     end;
  1488.                 tx:=parm^.pb_x+14+Attr.charSWidth;
  1489.                 ty:=parm^.pb_y+SysInfo.SFHeight+1;
  1490.                 btn:=StrLPas(PChar(parm^.pb_parm),40);
  1491.                 while btn[length(btn)]=' ' do btn[0]:=chr(ord(btn[0])-1);
  1492.                 scpos:=pos('&',btn);
  1493.                 if scpos>0 then
  1494.                     begin
  1495.                         for q:=scpos to length(btn)-1 do btn[q]:=btn[q+1];
  1496.                         btn[0]:=chr(ord(btn[0])-1)
  1497.                     end;
  1498.                 gem.vswr_mode(vdiHandle,MD_ERASE);
  1499.                 gem.vst_color(vdiHandle,SysInfo.BGDefCol);
  1500.                 v_gtext(vdiHandle,tx,ty,btn);
  1501.                 gem.vswr_mode(vdiHandle,MD_TRANS);
  1502.                 v_gtext(vdiHandle,tx,ty,btn);
  1503.                 if bTst(parm^.pr_currstate,DISABLED) then gem.vst_effects(vdiHandle,TF_LIGHTENED);
  1504.                 gem.vst_color(vdiHandle,Black);
  1505.                 v_gtext(vdiHandle,tx,ty,btn);
  1506.                 if scpos>0 then
  1507.                     begin
  1508.                         if bTst(parm^.pr_currstate,DISABLED) then gem.vst_effects(vdiHandle,TF_UNDERLINED or TF_LIGHTENED)
  1509.                         else
  1510.                             begin
  1511.                                 gem.vst_effects(vdiHandle,TF_UNDERLINED);
  1512.                                 gem.vst_color(vdiHandle,HOTCOL)
  1513.                             end;
  1514.                         v_gtext(vdiHandle,tx+(scpos-1)*Attr.charSWidth,ty,' ')
  1515.                     end;
  1516.                 RestoreVWrk
  1517.             end;
  1518.         DrawRadioButton:=NORMAL
  1519.     end;
  1520.  
  1521.  
  1522. function DrawComboTitle(dummy1,dummy2: pointer; parm: PARMBLKPtr): word;
  1523.     var clip         : ARRAY_4;
  1524.         btn          : string[40];
  1525.         tx,ty,scpos,q: integer;
  1526.  
  1527.     begin
  1528.         InitVWrk;
  1529.         with parm^ do
  1530.             begin
  1531.                 clip[0]:=pb_xc;
  1532.                 clip[1]:=pb_yc;
  1533.                 clip[2]:=pb_xc+pb_wc-1;
  1534.                 clip[3]:=pb_yc+pb_hc-1;
  1535.                 vs_clip(Application^.vdiHandle,CLIP_ON,clip);
  1536.                 clip[0]:=pb_x;
  1537.                 clip[1]:=pb_y;
  1538.                 clip[2]:=pb_x+pb_w-1;
  1539.                 clip[3]:=pb_y+pb_h-1
  1540.             end;
  1541.         with Application^ do
  1542.             begin
  1543.                 tx:=parm^.pb_x+1;
  1544.                 ty:=parm^.pb_y+SysInfo.SFHeight;
  1545.                 btn:=StrLPas(PChar(parm^.pb_parm),40);
  1546.                 while btn[length(btn)]=' ' do btn[0]:=chr(ord(btn[0])-1);
  1547.                 scpos:=pos('&',btn);
  1548.                 if scpos>0 then
  1549.                     begin
  1550.                         for q:=scpos to length(btn)-1 do btn[q]:=btn[q+1];
  1551.                         btn[0]:=chr(ord(btn[0])-1)
  1552.                     end;
  1553.                 vsf_perimeter(vdiHandle,PER_OFF);
  1554.                 vsf_interior(vdiHandle,FIS_SOLID);
  1555.                 vsf_color(vdiHandle,SysInfo.BGDefCol);
  1556.                 v_bar(vdiHandle,clip);
  1557.                 gem.vswr_mode(vdiHandle,MD_TRANS);
  1558.                 if bTst(parm^.pr_currstate,DISABLED) then gem.vst_effects(vdiHandle,TF_LIGHTENED);
  1559.                 gem.vst_color(vdiHandle,Black);
  1560.                 v_gtext(vdiHandle,tx,ty,btn);
  1561.                 if scpos>0 then
  1562.                     begin
  1563.                         if bTst(parm^.pr_currstate,DISABLED) then gem.vst_effects(vdiHandle,TF_UNDERLINED or TF_LIGHTENED)
  1564.                         else
  1565.                             begin
  1566.                                 gem.vst_effects(vdiHandle,TF_UNDERLINED);
  1567.                                 gem.vst_color(vdiHandle,HOTCOL)
  1568.                             end;
  1569.                         v_gtext(vdiHandle,tx+(scpos-1)*Attr.charSWidth,ty,' ')
  1570.                     end;
  1571.                 if bTst(parm^.pr_currstate,SELECTED) then
  1572.                     begin
  1573.                         gem.vswr_mode(vdiHandle,MD_XOR);
  1574.                         vsf_color(vdiHandle,Black);
  1575.                         v_bar(vdiHandle,clip)
  1576.                     end
  1577.             end;
  1578.         RestoreVWrk;
  1579.         DrawComboTitle:=NORMAL
  1580.     end;
  1581.  
  1582. end.